﻿@using SmartStore.PayPal.Settings;
@using SmartStore.PayPal.Models;
@using SmartStore.Web.Framework;
@model PayPalDirectConfigurationModel
@{
	Layout = "";
	Html.AddCssFileParts(true, "~/Plugins/SmartStore.PayPal/Content/smartstore.paypal.css");
}

<div class="plugin-actions">
	<button type="submit" name="save" class="btn btn-primary" value="save">
		<i class="fa fa-check"></i>
		<span>@T("Admin.Common.Save")</span>
	</button>
</div>

<div class="plugin-configuration">
	<div>
		<div class="alert alert-info alert-dismissible">
			@Html.Raw(T("Plugins.Payments.PayPalDirect.AdminInstruction"))
			<button class="close" data-dismiss="alert">&times;</button>
		</div>
	</div>
	<div>
		<a href="https://www.paypal.com/" target="_blank">
			<img src="@Url.Content("~/Plugins/SmartStore.PayPal/Content/branding.png")" alt="PayPal" />
		</a>
	</div>
</div>

@{ Html.RenderAction("StoreScopeConfiguration", "Setting", new { area = "Admin" }); }

@using (Html.BeginForm())
{
    <table class="adminContent configure-paypal-direct">        
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.TransactMode)
            </td>
            <td class="adminData">
				@Html.SettingEditorFor(model => model.TransactMode, Html.DropDownListFor(model => model.TransactMode, new List<SelectListItem>
				{
					new SelectListItem { Text = T("Plugins.Payments.PayPalDirect.ModeAuth"), Value = TransactMode.Authorize.ToString(), Selected = Model.TransactMode == TransactMode.Authorize },
					new SelectListItem { Text = T("Plugins.Payments.PayPalDirect.ModeAuthAndCapture"), Value = TransactMode.AuthorizeAndCapture.ToString(), Selected = Model.TransactMode == TransactMode.AuthorizeAndCapture }
				}))
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.UseSandbox)
            </td>
            <td class="adminData">
				@*multistore context not possible, see IPN handling*@
                @Html.EditorFor(model => model.UseSandbox)
                @Html.ValidationMessageFor(model => model.UseSandbox)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ApiAccountName)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ApiAccountName)
                @Html.ValidationMessageFor(model => model.ApiAccountName)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ApiAccountPassword)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ApiAccountPassword, null, new { htmlAttributes = new { autocomplete = "new-password", value = Model.ApiAccountPassword } })
                @Html.ValidationMessageFor(model => model.ApiAccountPassword)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.Signature)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.Signature)
                @Html.ValidationMessageFor(model => model.Signature)
            </td>
        </tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.IpnChangesPaymentStatus)
			</td>
			<td class="adminData">
				@Html.SettingEditorFor(model => model.IpnChangesPaymentStatus)
				@Html.ValidationMessageFor(model => model.IpnChangesPaymentStatus)
			</td>
		</tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.AdditionalFee)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.AdditionalFee, null, new { postfix = Model.PrimaryStoreCurrencyCode })
                @Html.ValidationMessageFor(model => model.AdditionalFee)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.AdditionalFeePercentage)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.AdditionalFeePercentage)
                @Html.ValidationMessageFor(model => model.AdditionalFeePercentage)
            </td>
        </tr>
    </table>
}